perm filename BUG.SAI[HAL,HE] blob sn#232787 filedate 1976-08-24 generic text, type C, neo UTF8
COMMENT ⊗   VALID 00002 PAGES
C REC  PAGE   DESCRIPTION
C00001 00001
C00002 00002	the AL to S-expression translator
C00005 ENDMK
C⊗;
comment the AL to S-expression translator;

BEGIN "PARSE"

REQUIRE 1024 STRING_PDL;  REQUIRE 1024 STRING_SPACE;  REQUIRE 1024 SYSTEM_PDL;
require "[][]" delimiters;

				define
!	=[comment],
hasher	=256,
tab	='11,
lf	='12,
ff	='14,
cr	='15,
space	='40,
dquote	='42,
crlf	=[('15&'12)],
preload_array(name, defs, type, first, len)=[
	preload_with defs null; type array name[first:first+len] ];

! N.B. -- preload_array always creates an array 1 longer than requested;

! if /nB is set in the command line then assume he wants a debugging parser;

				define
decipher_debug(banner)=[
    whilec [cvps(banner)≠lf]    doc [assignc banner=cvps(banner)[2 to ∞];] endc
    whilec [cvps(banner)≠tab]   doc [assignc banner=cvps(banner)[2 to ∞];] endc
    whilec [cvps(banner)≠space] doc [assignc banner=cvps(banner)[2 to ∞];] endc
    ifc cvps(banner)[2 for 1]="0"
	thenc define debug_compile=false;
	elsec define debug_compile=true;
    endc];

ifc ¬declaration(debug_compile) thenc decipher_debug(compiler_banner) endc
require ifc ¬debug_compile
	thenc " NON-" elsec " " endc & "DEBUGGING VERSION " message;
ifc debug_compile thenc EXTERNAL PROCEDURE BAIL; endc

				define
indices(name, postfix)=[
    redefine xxcount=0;
    redefine xx(xxarg)=[
	redefine xxtemp=[define xxarg] & [postfix=xxcount];
	xxtemp;
	redefine xxcount=xxcount+1;];
    name];

! ID postfix conventions

	_VALUE	AL data types
	_RES	reserved word types
	_beg	reserved word group begin
	_end	reserved word group end
	_R	REDUCE action routines
	_P	PARSE action routines
	_TOKEN	scanner token types
	_CM	condition monitors
	_X	indices of various sorts
	_METRIC	dimensional analysis non-sense
	_DIMEN	how to combine various matrix operands
;

! **********;     require "SNAILR[HAL,HE]" source_file;     ! **********;